#include "dayinfoui.h"
#include "ui_dayinfoui.h"

DayInfoUI::DayInfoUI(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::DayInfoUI)
{
    ui->setupUi(this);
}

DayInfoUI::~DayInfoUI()
{
    delete ui;
}

void DayInfoUI::setData(const QString &temp, const QString &type,
                           const QString &range, const QString &city) {
    ui->temp->setText(QString("%1°C").arg(temp));
    ui->weatherType->setText(type);
    ui->tempRange->setText(QString("%1℃").arg(range));

    ui->city->setText(city);
}

void DayInfoUI::setIcon(const QPixmap &icon) {
    if (!icon.isNull()) {
        ui->weatherIconLb->setPixmap(icon.scaled(80, 80, Qt::KeepAspectRatio));
    }
}
